import httpInstance from "@/utils/http.js";

//密码登录
export function loginByPasswordAPI({account,password}){
    return httpInstance({
        url:'/user/login',
        method:'post',
        data:{
            uid:account,
            password:password
        },
    }).catch(function (err) {
        console.log("登录请求失败",err)
    })
}

//短信验证码登录
export function loginBySMSAPI({phoneNumber,captcha}){
    return httpInstance({
        url:'/user/login/sms',
        method:'post',
        data:{
            phone: phoneNumber,
            code: captcha
        },
    }).catch(function (err) {
        console.log("短信登录请求失败",err)
    })
}

//发送短信验证码
export function sendSMSAPI(phoneNumber){
    return httpInstance({
        url:'/user/sms/send',
        method:'post',
        data:{
            phone: phoneNumber
        },
    }).catch(function (err) {
        console.log("发送短信验证码失败",err)
    })
}

export function registerAPI(user){
    return httpInstance({
        url:'/user/register',
        method:'post',
        data:user
    })
}
